﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="adminAttribute.aspx.cs" Inherits="Admin_adminProductAttribute" %>
<%@ Register Src="adminfoot.ascx" TagName="adminfoot" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <link rel="stylesheet" href="imgs/admin.css" type="text/css" media="all" />
    <script type="text/javascript" src="../DotNet_net/js/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="../DotNet_net/js/jquery.form.js"></script>
    <script type="text/javascript">
jQuery.fn.limit=function(){
    var self = $("div[limit]");
    self.each(function(){
        var objString = $(this).text();
        var objLength = $(this).text().length;
        var num = $(this).attr("limit");
        if(objLength > num){
$(this).attr("title",objString);
            objString = $(this).text(objString.substring(0,num) + "...");
        }
    })
}
$(function(){
    $(document.body).limit();
})
</script> 
    <script type="text/javascript">
    function view(id){
	document.getElementById(id).style.display=''	
    }
    function hide(id){
	document.getElementById(id).style.display='none'		
    }
    function viewComMakeOps()
    {
        view('add');
        view('insertTb')
        hide('adminC');
        document.getElementById("makeHtmlTab").getElementsByTagName("li")[0].className="hover";document.getElementById("makeHtmlTab").getElementsByTagName("li")[1].className=""
        
    }
    function viewSpeMakeOps()
    {
 
        hide('add');
        hide('insertTb')
        view('adminC');
        document.getElementById("makeHtmlTab").getElementsByTagName("li")[1].className="hover";document.getElementById("makeHtmlTab").getElementsByTagName("li")[0].className=""
    }  
    </script>
</head>
<body onload='$("#loading").hide()'>
<div id="loading" style="display:block" >   
    <div class="loading-indicator">   
        页面正在加载中...   
    </div>   
</div>

    <form name="addform" id="addformAjax"  method="post">    
    <div id="cpcontainer" class="container">
<!--当前导航-->
<%--<script type="text/JavaScript">if(parent.document.getElementById('admincpnav')) parent.document.getElementById('admincpnav').innerHTML='后台首页&amp;nbsp;&amp;raquo;&amp;nbsp;生成&amp;nbsp;&amp;raquo;&amp;nbsp;生成选项';</script>--%>
<ul id="makeHtmlTab">
<li class="hover"><a href="javascript:void(0)" onclick="viewComMakeOps();">产品属性管理</a></li>
<li><a href="javascript:void(0)" onclick="viewSpeMakeOps();">
        添加产品属性</a></li>
</ul>
<table class="tb">
<tbody id="add">
	<tr bgcolor="#f5fafe">
	<td style="width: 5%">属性ID<a href="#"><img src="imgs/minus.gif" title="按ID排序" /></a></td>
	<td style="width:10%; overflow:hidden;line-height:10px; height:20px;  text-overflow:ellipsis; white-space:nowrap;"> 属性名称(AttributeName)</td>
            <td style="overflow: hidden; width: 10%; line-height: 10px; white-space: nowrap;
                height: 20px; text-overflow: ellipsis">
                属性标记（mark）</td>
	<td style="width: 20%" align="left">
        (编辑,删除)操作</td>
  </tr>
  <asp:Repeater ID="Repeater1" runat="server">
        <ItemTemplate>
        <tr bgcolor="#f5fafe" id="tr<%#Eval("AttributeID")%>">
	<td ><%#Eval("AttributeID")%></td>
	<td style="width: 179px" ><%#Eval("AttributeName")%></td>	
	<td><%#Eval("mark") %></td>   
	<td style="width: 600px">
	<script type="text/javascript">
	function EditPageSeo(id)
	{
        location.href="adminAttribute.aspx?action=edit&id="+id;     
	}
	</script>
	  <input id="Button5" type="button" value="编辑" class='btn' title='<%#Eval("AttributeID")%>' onclick="EditPageSeo(this.title)"/>
	   <input id="btnDel" type="button" value="删除" class='btn' title='<%#Eval("AttributeID")%>' onclick="if(confirm('确定要删除吗')){$('#loading').show();$.get('adminAttribute.aspx?action=del&id='+this.title,'',function(msg){location.href=location.href;});}else{return false}"/>
	</td>
  </tr>
        </ItemTemplate>
        </asp:Repeater>
   </tbody> 
  
<tbody id="adminC" style="display:none;">
<tr>
<td>
<table width="100%" border="0">
    <tbody>    

    <tr>
        <th width="25%" align="right" style="height: 32px">
            &nbsp;<span style="color:Red">*</span>属性名称(AttributeName)</th>
        <td width="75%" style="height: 32px">
            <input title="属性名称" type="text" class="inputField followedObj" maxlength="200" size="40" name="AttributeName" id="AttributeName" runat="server"/>&nbsp;属性标记：<%=attributeDp("attr_add", 10)%></td>
    </tr>
    <tr>
        <th valign="top" align="right">
        </th>
        <td></td>
    </tr>
    
    <tr>
        <th valign="top" align="right"></th>
        <td>
            <input type="button" value="添加属性" class="btn" name="Submit" id="tijiao"/>
             <input type="reset" class="btn" value="重置"/>
        </td>
    </tr>
</tbody>
</table>
 
        <input id="Hiddenid" runat="server" type="hidden" name="Hiddenid"/></td>                                 
  </tr>
                        

</tbody>
    
</table>
    <table class="tb mt20" id="insertTb">    
    <tr class="thead"><th colspan="8">   编辑属性：</th></tr>	
        <tr align="center">
             <td style="width: 114px">
                 属性ID</td>
    <td style="width: 200px" align="left"><input readonly="readonly" id="attributeid_txt" style="width: 190px" type="text" runat="server" /></td>
            <td align=center style="width: 103px">
                属性名称：</td>
                <td style="width: 153px" align="left">
                    <input id="attributename_txt" type="text" runat="server" /></td>
            <td align="center" colspan="1" style="width: 102px">
                属性标识：</td>
            <td align="left" colspan="1">
                <%=attributeDp("attr_edit",10) %>
            </td>
            <td align="left" colspan="4">
                &nbsp;<input type="button" value="确认修改" class="btn"  onclick="save()"/></td>
    </tr>
</table>
<uc1:adminfoot ID="Adminfoot1" runat="server" />
</div>
        

</form>
<script type="text/javascript">
$(document).ready(function(){
    var options = { 
        beforeSubmit:  showRequest,  // pre-submit callback 
        success:       showResponse,  // post-submit callback 
        // other available options: 
         url:       "adminAttribute.aspx?action=add",         // override for form's 'action' attribute 
       // type:        'post'        // 'get' or 'post', override for form's 'method' attribute 
        //dataType:  null        // 'xml', 'script', or 'json' (expected server response type) 
        clearForm: false,        // clear all form fields after successful submit 
        resetForm: false        // reset the form after successful submit 
 
        // $.ajax options can be used here too, for example: 
        //timeout:   3000 
    }; 
    $('#tijiao').click(function(){            
            $("#loading").show();
            $('#addformAjax').ajaxSubmit(options);
            return false;
    });
})
function showResponse(msg){ 
if(msg=="1")
        {
            
            alert("添加成功!!!");
            location.href=location.href;
        }
        else
        {
            alert(msg);
            $("#loading").hide();
        }
} 
function showRequest(formData, jqForm, options) 
{     			
    return true; 
} 
function save()
{
    var name=$("#attributeid_txt").attr("value");
    var id=$("#attributename_txt").attr("value");
    var mark=$("#attr_edit option:selected").attr("value");
    if(name!=""&&id!=""&&mark!="")
    {
        $.get("adminAttribute.aspx?action=save&id="+$("#attributeid_txt").attr("value")+"&name="+escape($("#attributename_txt").attr("value"))+"&mark="+mark,'',function(msg){alert(msg);location.href="adminAttribute.aspx";});
    }
    else
    {
        alert("请选择你要编辑的属性！");
    }
}
</script>
</body>
</html>
